package com.wesley.util.excel.strategy;

import com.wesley.util.excel.ValidateType;
import com.wesley.util.excel.annotation.Validate;

/**
 * @author:wesley
 */
public class StrategyFactory {

    private Object object;

    private ValidateStrategy vs;

    public StrategyFactory(Validate validate) {
        if (validate.value().equals(ValidateType.MobilePhone)){
            vs = new MobilePhoneStrategy();
        } else if(validate.value().equals(ValidateType.EMAIL)){
            vs = new EmailStrategy();
        } else {
            //非空
            vs = new NoNullStrategy();
        }
    }


    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public boolean checkValidate(){
        return vs.checkValidate(this.object);
    }
}
